package cn.bluethink.zentao.entity;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.Table;

import cn.bluethink.zentao.model.ZtTask;
import cn.bluethink.zentao.model.ZtUser;

/**
 * 禅道任务实体
 * 
 * @author 苏州中科蓝迪公司所有(c)2016-2021
 * @version 0.2.0
 * @brief zentao
 * @note 修订历史： 1、liuxn于2018/12/11 修订禅道任务实体类
 */
@Table(name = "zt_task")
public class ZtTaskEntity implements Serializable {

	private static final long serialVersionUID = 4230206408703225253L;

	/**
	 * 任务主键Id
	 */
	@Id
	@Column(name = "id")
	private Long tid;

	/**
	 * 禅道任务编码
	 */
	private Integer taskNum;

	/**
	 * 任务名称
	 */
	private String name;

	/**
	 * 任务所在项目Id
	 */
	private Integer project;
	
	/**
	 * 任务内容
	 */
	private String content;

	/**
	 * 任务状态，同eguan+保持一致
	 * 这里需要查询之后设置该状态信息
	 */
	private Integer status;

	/**
	 * 任务优先级
	 */
	private Integer priority;

	/**
	 * 任务发布者账号
	 */
	private String caccount;
	
	/**
	 * 任务发布者Id
	 */
	private Long cuid;
	
	/**
	 * 任务发布者名称
	 */
	private String cuname;

	/**
	 * 任务截止时间
	 */
	private Date etime;

	/**
	 * 任务完成时间
	 */
	private Date ftime;

	/**
	 * 任务执行者账号
	 */
	private String doaccount;
	
	/**
	 * 任务执行者用户Id
	 */
	private Long douid;
	
	/**
	 * 任务执行者名称
	 */
	private String douname;

	/**
	 * 任务备注
	 */
	private String remark;

	public ZtTaskEntity() {

	}

	/**
	 * 创建禅道任务模型
	 * @return
	 */
	public ZtTask createZantaoTask() {
		ZtTask task = new ZtTask(tid, taskNum, name, content);
		task.setStatus(status);
		task.setPriority(priority);

		if (cuid != null && cuid > 0) {
			task.setCuser(new ZtUser(cuid, cuname, null));
		}

		task.setEtime(etime);
		task.setFtime(ftime);

		if (douid != null && douid > 0) {
			task.setDouser(new ZtUser(douid, douname, null));
		}

		task.setRemark(remark);
		return task;
	}

	public Long getTid() {
		return tid;
	}

	public void setTid(Long tid) {
		this.tid = tid;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	public Integer getPriority() {
		return priority;
	}

	public void setPriority(Integer priority) {
		this.priority = priority;
	}

	public Long getCuid() {
		return cuid;
	}

	public void setCuid(Long cuid) {
		this.cuid = cuid;
	}

	public String getCuname() {
		return cuname;
	}

	public void setCuname(String cuname) {
		this.cuname = cuname;
	}

	public Integer getProject() {
		return project;
	}

	public void setProject(Integer project) {
		this.project = project;
	}

	public Date getEtime() {
		return etime;
	}

	public void setEtime(Date etime) {
		this.etime = etime;
	}

	public Date getFtime() {
		return ftime;
	}

	public void setFtime(Date ftime) {
		this.ftime = ftime;
	}

	public Long getDouid() {
		return douid;
	}

	public void setDouid(Long douid) {
		this.douid = douid;
	}

	public String getDouname() {
		return douname;
	}

	public void setDouname(String doname) {
		this.douname = doname;
	}

	public Integer getTaskNum() {
		return taskNum;
	}

	public void setTaskNum(Integer taskNum) {
		this.taskNum = taskNum;
	}

	public String getCaccount() {
		return caccount;
	}

	public void setCaccount(String caccount) {
		this.caccount = caccount;
	}

	public String getDoaccount() {
		return doaccount;
	}

	public void setDoaccount(String doaccount) {
		this.doaccount = doaccount;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}
	
}
